/*** 
 * @Author: LVGRAPE
 * @Date: 2023-07-10 14:00:49
 * @LastEditTime: 2023-11-08 11:21:24
 * @LastEditors: LVGRAPE
 * @Description: #inc
 * @FilePath: \ZINO_MCU_SOURCE\ZINO_SRC\os_timer\os_timer.h
 * @可以输入预定的版权声明、个性签名、空行等
 */

#ifndef __OS_TIMER_H_
#define __OS_TIMER_H_
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

#include <stdint.h>
#include <stdbool.h>
typedef void(*os_timer_func_t)(void* parg);
typedef struct os_timer_struct
{
    struct os_timer_struct* timer_next;
    uint32_t timer_period;      //for loop OR period =0 for single run.
    uint32_t timer_current;
    os_timer_func_t timer_func;
    void* timer_arg;
    uint8_t timer_id;
    uint8_t start;
    uint8_t repeat;
} os_timer_t;

void os_timer_init(os_timer_t* ptimer, os_timer_func_t pfunction, void* parg);
void os_timer_destroy(os_timer_t* ptimer);
void os_timer_start(os_timer_t* ptimer, uint32_t ms, bool repeat_flag);
void os_timer_stop(os_timer_t* ptimer);
void os_timer_routine_init();
void os_timer_routine(void);
void check_os_timer_list();
void os_timer_test();

#ifdef __cplusplus
}
#endif // __cplusplus
#endif
